package run.newbug.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import run.newbug.pojohw.User;

@RestController
//@RequestMapping("")
@PropertySource(value="classpath:/user.properties",encoding = "utf-8")
public class HelloController {
    @Value("${userinfo2.name}")
    String name;

    @Value("${user.info}")
    String name2;

    @RequestMapping("hello")
    public String hello(){
        return "欢迎使用SpringBoot, "+name2;
    }

    @RequestMapping("getUser")
    public User getUser(){
        User u = new User(20, "Jack", "man", 1);
        return u;
    }

    @RequestMapping("getUser2")
    public User getUser2(){
        User u = new User();
        u.setId(10).setName("DAMN").setAge(20).setSex("male");
        return u;
    }
}
